.class public Lcom/burstly/lib/util/UiSafeWebView;
.super Landroid/webkit/WebView;
.source "UiSafeWebView.java"

# interfaces
.implements Lcom/burstly/lib/component/networkcomponent/burstly/html/IDestroyableActivityLifecycleAware;
.implements Lcom/burstly/lib/component/networkcomponent/burstly/OverlayContainer$IOverlayListener;


# instance fields
.field private mHostingOverlay:Lcom/burstly/lib/component/networkcomponent/burstly/OverlayContainer;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Lcom/burstly/lib/component/networkcomponent/burstly/OverlayContainer",
            "<*>;"
        }
    .end annotation
.end field

.field private mInterstitial:Z

.field private final mUiHandler:Landroid/os/Handler;

.field private volatile mWasDestroyed:Z


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 2
    .parameter "context"

    .prologue
    .line 65
    invoke-direct {p0, p1}, Landroid/webkit/WebView;-><init>(Landroid/content/Context;)V

    .line 47
    new-instance v0, Landroid/os/Handler;

    invoke-static {}, Landroid/os/Looper;->getMainLooper()Landroid/os/Looper;

    move-result-object v1

    invoke-direct {v0, v1}, Landroid/os/Handler;-><init>(Landroid/os/Looper;)V

    iput-object v0, p0, Lcom/burstly/lib/util/UiSafeWebView;->mUiHandler:Landroid/os/Handler;

    .line 66
    invoke-virtual {p0}, Lcom/burstly/lib/util/UiSafeWebView;->getSettings()Landroid/webkit/WebSettings;

    move-result-object v0

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Landroid/webkit/WebSettings;->setJavaScriptEnabled(Z)V

    .line 67
    return-void
.end method

.method static synthetic access$001(Lcom/burstly/lib/util/UiSafeWebView;Ljava/lang/String;)V
    .locals 0
    .parameter "x0"
    .parameter "x1"

    .prologue
    .line 37
    invoke-super {p0, p1}, Landroid/webkit/WebView;->loadUrl(Ljava/lang/String;)V

    return-void
.end method

.method static synthetic access$101(Lcom/burstly/lib/util/UiSafeWebView;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    .locals 0
    .parameter "x0"
    .parameter "x1"
    .parameter "x2"
    .parameter "x3"

    .prologue
    .line 37
    invoke-super {p0, p1, p2, p3}, Landroid/webkit/WebView;->loadData(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    return-void
.end method

.method static synthetic access$201(Lcom/burstly/lib/util/UiSafeWebView;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    .locals 0
    .parameter "x0"
    .parameter "x1"
    .parameter "x2"
    .parameter "x3"
    .parameter "x4"
    .parameter "x5"

    .prologue
    .line 37
    invoke-super/range {p0 .. p5}, Landroid/webkit/WebView;->loadDataWithBaseURL(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    return-void
.end method

.method private static shouldPostInMainThread()Z
    .locals 2

    .prologue
    .line 178
    sget v0, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v1, 0xe

    if-lt v0, v1, :cond_0

    invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Thread;->getName()Ljava/lang/String;

    move-result-object v0

    const-string v1, "main"

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method


# virtual methods
.method public getHostingOverlay()Lcom/burstly/lib/component/networkcomponent/burstly/OverlayContainer;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Lcom/burstly/lib/component/networkcomponent/burstly/OverlayContainer",
            "<*>;"
        }
    .end annotation

    .prologue
    .line 206
    iget-object v0, p0, Lcom/burstly/lib/util/UiSafeWebView;->mHostingOverlay:Lcom/burstly/lib/component/networkcomponent/burstly/OverlayContainer;

    return-object v0
.end method

.method public isInterstitial()Z
    .locals 1

    .prologue
    .line 188
    iget-boolean v0, p0, Lcom/burstly/lib/util/UiSafeWebView;->mInterstitial:Z

    return v0
.end method

.method public loadData(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    .locals 7
    .parameter "data"
    .parameter "mimeType"
    .parameter "encoding"

    .prologue
    .line 115
    iget-boolean v0, p0, Lcom/burstly/lib/util/UiSafeWebView;->mWasDestroyed:Z

    if-nez v0, :cond_0

    .line 116
    invoke-static {}, Lcom/burstly/lib/util/UiSafeWebView;->shouldPostInMainThread()Z

    move-result v0

    if-eqz v0, :cond_1

    .line 117
    iget-object v6, p0, Lcom/burstly/lib/util/UiSafeWebView;->mUiHandler:Landroid/os/Handler;

    new-instance v0, Lcom/burstly/lib/util/UiSafeWebView$2;

    move-object v1, p0

    move-object v2, p0

    move-object v3, p1

    move-object v4, p2

    move-object v5, p3

    invoke-direct/range {v0 .. v5}, Lcom/burstly/lib/util/UiSafeWebView$2;-><init>(Lcom/burstly/lib/util/UiSafeWebView;Lcom/burstly/lib/component/networkcomponent/burstly/html/IDestroyableActivityLifecycleAware;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    invoke-virtual {v6, v0}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 128
    :cond_0
    :goto_0
    return-void

    .line 125
    :cond_1
    invoke-super {p0, p1, p2, p3}, Landroid/webkit/WebView;->loadData(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0
.end method

.method public loadDataWithBaseURL(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    .locals 9
    .parameter "baseUrl"
    .parameter "data"
    .parameter "mimeType"
    .parameter "encoding"
    .parameter "historyUrl"

    .prologue
    .line 133
    iget-boolean v0, p0, Lcom/burstly/lib/util/UiSafeWebView;->mWasDestroyed:Z

    if-nez v0, :cond_0

    .line 134
    invoke-static {}, Lcom/burstly/lib/util/UiSafeWebView;->shouldPostInMainThread()Z

    move-result v0

    if-eqz v0, :cond_1

    .line 135
    iget-object v8, p0, Lcom/burstly/lib/util/UiSafeWebView;->mUiHandler:Landroid/os/Handler;

    new-instance v0, Lcom/burstly/lib/util/UiSafeWebView$3;

    move-object v1, p0

    move-object v2, p0

    move-object v3, p1

    move-object v4, p2

    move-object v5, p3

    move-object v6, p4

    move-object v7, p5

    invoke-direct/range {v0 .. v7}, Lcom/burstly/lib/util/UiSafeWebView$3;-><init>(Lcom/burstly/lib/util/UiSafeWebView;Lcom/burstly/lib/component/networkcomponent/burstly/html/IDestroyableActivityLifecycleAware;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    invoke-virtual {v8, v0}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 146
    :cond_0
    :goto_0
    return-void

    .line 143
    :cond_1
    invoke-super/range {p0 .. p5}, Landroid/webkit/WebView;->loadDataWithBaseURL(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0
.end method

.method public loadUrl(Ljava/lang/String;)V
    .locals 2
    .parameter "url"

    .prologue
    .line 92
    iget-boolean v0, p0, Lcom/burstly/lib/util/UiSafeWebView;->mWasDestroyed:Z

    if-nez v0, :cond_0

    .line 93
    invoke-static {}, Lcom/burstly/lib/util/UiSafeWebView;->shouldPostInMainThread()Z

    move-result v0

    if-eqz v0, :cond_1

    .line 94
    iget-object v0, p0, Lcom/burstly/lib/util/UiSafeWebView;->mUiHandler:Landroid/os/Handler;

    new-instance v1, Lcom/burstly/lib/util/UiSafeWebView$1;

    invoke-direct {v1, p0, p0, p1}, Lcom/burstly/lib/util/UiSafeWebView$1;-><init>(Lcom/burstly/lib/util/UiSafeWebView;Lcom/burstly/lib/component/networkcomponent/burstly/html/IDestroyableActivityLifecycleAware;Ljava/lang/String;)V

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 111
    :cond_0
    :goto_0
    return-void

    .line 105
    :cond_1
    :try_start_0
    invoke-super {p0, p1}, Landroid/webkit/WebView;->loadUrl(Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 107
    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method public onCloseOverlay()V
    .locals 1

    .prologue
    .line 224
    invoke-virtual {p0}, Lcom/burstly/lib/util/UiSafeWebView;->getContext()Landroid/content/Context;

    move-result-object v0

    check-cast v0, Landroid/app/Activity;

    invoke-virtual {p0, v0}, Lcom/burstly/lib/util/UiSafeWebView;->onDestroy(Landroid/app/Activity;)V

    .line 225
    return-void
.end method

.method public onDestroy(Landroid/app/Activity;)V
    .locals 1
    .parameter "curerntActivity"

    .prologue
    .line 79
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/burstly/lib/util/UiSafeWebView;->mWasDestroyed:Z

    .line 80
    return-void
.end method

.method protected onDraw(Landroid/graphics/Canvas;)V
    .locals 2
    .parameter "canvas"

    .prologue
    .line 160
    invoke-super {p0, p1}, Landroid/webkit/WebView;->onDraw(Landroid/graphics/Canvas;)V

    .line 162
    sget v0, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v1, 0xb

    if-lt v0, v1, :cond_0

    .line 163
    invoke-virtual {p0}, Lcom/burstly/lib/util/UiSafeWebView;->invalidate()V

    .line 165
    :cond_0
    return-void
.end method

.method public onKey(Landroid/app/Activity;ILandroid/view/KeyEvent;)Z
    .locals 1
    .parameter "activity"
    .parameter "keyCode"
    .parameter "event"

    .prologue
    .line 150
    const/4 v0, 0x0

    return v0
.end method

.method public onKeyDown(ILandroid/view/KeyEvent;)Z
    .locals 1
    .parameter "keyCode"
    .parameter "event"

    .prologue
    .line 155
    iget-boolean v0, p0, Lcom/burstly/lib/util/UiSafeWebView;->mInterstitial:Z

    if-eqz v0, :cond_0

    const/16 v0, 0x52

    if-eq p1, v0, :cond_1

    :cond_0
    invoke-super {p0, p1, p2}, Landroid/webkit/WebView;->onKeyDown(ILandroid/view/KeyEvent;)Z

    move-result v0

    if-eqz v0, :cond_2

    :cond_1
    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_2
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public onPause(Landroid/app/Activity;)V
    .locals 2
    .parameter "curerntActivity"
    .annotation build Landroid/annotation/TargetApi;
        value = 0xb
    .end annotation

    .prologue
    .line 72
    sget v0, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v1, 0xa

    if-le v0, v1, :cond_0

    .line 73
    invoke-virtual {p0}, Lcom/burstly/lib/util/UiSafeWebView;->onPause()V

    .line 75
    :cond_0
    return-void
.end method

.method public onResume(Landroid/app/Activity;)V
    .locals 2
    .parameter "curerntActivity"
    .annotation build Landroid/annotation/TargetApi;
        value = 0xb
    .end annotation

    .prologue
    .line 85
    sget v0, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v1, 0xa

    if-le v0, v1, :cond_0

    .line 86
    invoke-virtual {p0}, Lcom/burstly/lib/util/UiSafeWebView;->onResume()V

    .line 88
    :cond_0
    return-void
.end method

.method public onShowOverlay()V
    .locals 0

    .prologue
    .line 220
    return-void
.end method

.method public setHostingOverlay(Lcom/burstly/lib/component/networkcomponent/burstly/OverlayContainer;)V
    .locals 0
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lcom/burstly/lib/component/networkcomponent/burstly/OverlayContainer",
            "<*>;)V"
        }
    .end annotation

    .prologue
    .line 215
    .local p1, hostingOverlay:Lcom/burstly/lib/component/networkcomponent/burstly/OverlayContainer;,"Lcom/burstly/lib/component/networkcomponent/burstly/OverlayContainer<*>;"
    iput-object p1, p0, Lcom/burstly/lib/util/UiSafeWebView;->mHostingOverlay:Lcom/burstly/lib/component/networkcomponent/burstly/OverlayContainer;

    .line 216
    return-void
.end method

.method public setInterstitial(Z)V
    .locals 0
    .parameter "isInterstitial"

    .prologue
    .line 197
    iput-boolean p1, p0, Lcom/burstly/lib/util/UiSafeWebView;->mInterstitial:Z

    .line 198
    return-void
.end method

.method public wasDestroyed()Z
    .locals 1

    .prologue
    .line 169
    iget-boolean v0, p0, Lcom/burstly/lib/util/UiSafeWebView;->mWasDestroyed:Z

    return v0
.end method
